#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#define LL long long
using namespace std;

struct Rect {
  int x1, x2, y1, y2;
  Rect(int a, int b, int c, int d) {
    x1 = a, y1 = b;
    x2 = c, y2 = d;
  }
  LL GetSize() {
    return (LL)(y2 - y1 + 1) * (x2 - x1 + 1);
  }
};

void Swap(vector<Rect>& rect) {
  for (int i = 0; i < rect.size(); i++) {
    swap(rect[i].x1, rect[i].y1);
    swap(rect[i].x2, rect[i].y2);
  }
}

void Split(vector<Rect>& rect, int a) {
  for (int i = 0; i < rect.size(); i++) {
    if (rect[i].x1 < a && a <= rect[i].x2) {
      rect.push_back(rect[i]);
      rect[i].x2 = a - 1;
      rect.back().x1 = a;
    }
  }
}

void Move(vector<Rect>& rect, int a, int b) {
  for (int i = 0; i < rect.size(); i++) {
    if (rect[i].x2 < a) {
      rect[i].y1 -= b;
      rect[i].y2 -= b;
    } else {
      rect[i].y1 += b;
      rect[i].y2 += b;
    }
  }
}

vector<LL> rect_size;
vector<int> father;
vector<LL> ans;

int GetF(int x) {
  if (father[x] == x) {
    return x;
  }
  return father[x] = GetF(father[x]);
}

void Merge(int u, int v) {
  u = GetF(u), v = GetF(v);
  if (u != v) {
    if (rect_size[u] < rect_size[v]) {
      swap(u, v);
    }
    father[v] = father[u];
    rect_size[u] += rect_size[v];
  }
}

bool Cross(int a, int b, int c, int d) {
  return max(b, d) - min(a, c) + 1 < (b - a) + (d - c) + 2;
}

bool Near(const Rect& u, const Rect& v) {
  if (u.x2 + 1 == v.x1 && Cross(u.y1, u.y2, v.y1, v.y2)) {
    return true;
  }
  if (u.y2 + 1 == v.y1 && Cross(u.x1, u.x2, v.x1, v.x2)) {
    return true;
  }
  return false;
}

int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  vector<Rect> rect;
  int n, x, y;
  cin >> n >> x >> y;

  rect.push_back(Rect(0, 0, x - 1, y - 1));
  for (int i = 0; i < n; i++) {
    string c;
    int a, b;

    cin >> c >> a >> b;
    if (c == "X") {
      Split(rect, a);
      Move(rect, a, b);
    } else {
      Swap(rect);
      Split(rect, a);
      Move(rect, a, b);
      Swap(rect);
    }
  }
  rect_size.resize(rect.size());
  father.resize(rect.size());

  for (int i = 0; i < rect.size(); i++) {
    father[i] = i;
    rect_size[i] = rect[i].GetSize();
  }
  for (int i = 0; i < rect.size(); i++) {
    for (int j = 0; j < rect.size(); j++) {
      if (Near(rect[i], rect[j])) {
        Merge(i, j);
      }
    }
  }

  for (int i = 0; i < rect_size.size(); i++) {
    if (father[i] == i) {
      ans.push_back(rect_size[i]);
    }
  }

  cout << ans.size() << "\n";
  sort(ans.begin(), ans.end());
  for (LL x : ans) {
    cout << x << " ";
  }
  cout << "\n";
  return 0;
}